﻿--提取岗位异动一级审批列表
Create proc [dbo].[proc_Employee_PostMove_GetApplyFList_Count]
(
	@CompanyId int,
	@Ename nvarchar(50),
	@Audit nvarchar(4)
)
as
	Begin
			Select Count(EE.Id)
			From employee_PostMove EE Inner Join Employee E on EE.EId=E.Id
			Where 
					(@CompanyId=0 Or E.Companyid = @CompanyId)
				And E.Ename like '%'+@ename+'%'
				and ee.Proposer is not null
				and (case when ee.firstaudit=1 then '1' 
					   when ee.firstaudit=0 and ee.firstauditperson is null then '0'
					   when ee.firstaudit=0 and ee.firstauditperson is not null then '1' end) like '%'+@audit+'%'
				and  e.state <> 5
		
	End
	RETURN
